package com.littcore.saap.common.session;

import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpServletResponseWrapper;

import com.littcore.saap.core.common.SaapConstants.LoginDevice;
import com.littcore.web.util.CookieUtils;

import me.chanjar.weixin.common.util.StringUtils;



public class SessionResponseWrap extends HttpServletResponseWrapper{
private SessionRequestWrap request;
    public SessionResponseWrap(SessionRequestWrap request,HttpServletResponse response) {
        super(response);
        this.request=request;
    }
    
    public void addSessionCookie(String sessionId){
        Cookie cookie=new Cookie(SessionRequestWrap.cookieSessionName,sessionId);
        CookieUtils.addCookie(this, cookie);
    }
    
 /*   public void commitSession(){
       String sessionId= request.commitSession(request.getSessionIdFromCookie(),LoginDevice.PC);

        if(StringUtils.isNotEmpty(sessionId)){
            this.addSessionCookie(sessionId);
        }
        
        if(StringUtils.isEmpty(sessionId)){
           request.commitSession(request.getTokenFromParam(),LoginDevice.WECHAT);           
        }
    }*/

}
